<script setup>
import useUserStore from "@/pinia/modules/userStore";
const userStore=useUserStore()
/*退出登录的回调函数*/
const handleLogout = () => {
  uni.showModal({
    title: "温馨提示",
    content: "确定退出神领物流吗?",
    success(result) {
      if (result.confirm) {
        userStore.logout()
        uni.redirectTo({ url: "/pages/login/index" });
        uni.showToast({ title: "退出成功", duration: 2000, icon: "success" });
      } else if (result.cancel) {
        uni.showToast({ title: "取消成功", duration: 2000, icon: "success" });
      }
    },
  });
};
</script>

<template>
  <view class="page-container">
    <view class="settings-list">
      <uni-list :border="false">
        <uni-list-item title="换绑手机" to="/subpkg_user/mobile/index" show-arrow />
        <uni-list-item title="修改密码" to="/subpkg_user/password/index" show-arrow />
        <uni-list-item title="消息通知设置" to="/subpkg_user/notify/index" show-arrow />
        <uni-list-item title="清理缓存" show-arrow />
      </uni-list>
    </view>
    <button class="logout-button" @tap="handleLogout">退出</button>
  </view>
</template>

<style lang="scss" scoped>
@import './index.scss';
</style>
